/**
 * 
 */
package eu.videotekata.movies;

import java.util.LinkedList;
import java.util.List;

import eu.videotekata.movies.mock.MockMovie;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;

/**
 * @author Nicky
 * Creates instances of Movie
 * @deprecated Temp class used during development.
 */
public class MovieFactory {
	
	/**
	 * Creates a movie
	 * @param name the name of the movie.
	 * @param year the year the movie was made.
	 * @param movieImpl the movie type implementation.
	 * @return a Movie object.
	 */
	public Movie createMovie(String name, short year, MovieImpl movieImpl) {
		Movie movie;
		if (MovieImpl.Mock == movieImpl) {
			movie = new MockMovie(name, year);
		} else {
			throw new NotImplementedException();
		}
		
		return movie;
	}
	
	private List<Movie> _list;
	
	public List<Movie> generateMockMovieList(){
		if (_list == null) {
			_list = new LinkedList<Movie>();
			
			for (short i=0; i < 10; ++i){
				_list.add(createMovie("Movie "+i+1, (short) (1999+i), MovieImpl.Mock));
			}
		}
		
		return _list;
	}
}
